home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.lang.c
- Subject: Re: CONVERTING INTEGER TO ASCII??????
- Date: 11 Mar 1996 08:22:40 -0600
- Organization: Usenet Fact Police (Undercover)
- Message-ID: <4i1cvg$1cg@solutions.solon.com>
- References: <4i17r9$2kn@maltese.eag.unisysgsg.com>
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4i17r9$2kn@maltese.eag.unisysgsg.com>,
- Daniel R. Ascheman <ssadra@maltese.eag.unisysgsg.com> wrote:
- >I need a way to convert an integer BACK to ascii so I can search for it
- >in a file using the strstr() function in a file. I NEED it as an integer
- >AND as an ascii, is it possible?
-
- If I said "no", would you believe me for an instant? If not, why do
- you ask?
-
- >As you know, strstr() is a char *, char * , so I can't use an int,
- >and itoa() does not exist in UNIX - I am in a slight bind.
-
- An extremely slight bind. Can anyone tell me why it is that dozens
- of people every year post this exact same question, and *none* of them
- hhave thought about sprintf?
-
- > return(2);
-
- Agh! Never use explicit values other than 0.
-
- >If no conversion is possible in C/UNIX, anyone have any other ideas?
-
- Look, it's trivial to write your own, and there's the printf family. I
- just don't get it - how do people manage to miss both of these options?
-
- >I would greatly appreciate comments and possible solutions.
-
- Sure about that first one? :)
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
- C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
- FUCK the communications decency act. Goddamned government. [literally.]
- The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
-